package com.rzx.mybackend.handler;

import com.rzx.mybackend.common.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * GlobalExceptionHandler
 *
 * @author renzhexian
 * @date 2025/7/15
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);

    @ExceptionHandler
    public String exceptionHandler(RuntimeException ex){
        log.error("异常信息：{}", ex.getMessage());
        return ex.getMessage();
    }

}
